package jmu.cultural_tourism;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@MapperScan("jmu.cultural_tourism.dao")
@CrossOrigin("*")
public class CulturalTourismApplication {

    private static final Logger logger = LoggerFactory.getLogger(CulturalTourismApplication.class);

    public static void main(String[] args) {
        try {
            SpringApplication.run(CulturalTourismApplication.class, args);
            logger.info("Application started successfully on port 8080");
        } catch (Exception e) {
            logger.error("Failed to start application", e);
        }
    }

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
